<!--
 * @Author: your name
 * @Date: 2020-10-14 14:54:00
 * @LastEditTime: 2021-06-15 10:36:12
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \nuxt-iview\components\home\swiper.vue
-->
<template>
  <div class="s12">
    <div v-swiper:mySwiper="options" class="s12">
      <div class="swiper-wrapper">
        <div class="swiper-slide" v-for="(item, index) of dataArr" :key="'item' + index">
          <img class="swiperWarpper_img" :src="item.banner_image" alt=""/>
        </div>
        <slot name="swiper-it"></slot>
      </div>
      <div class="swiper-pagination"  v-if="options.pagination.el" slot="pagination"></div>
      <div class="swiper-button-prev" v-if="options.prevButton" slot="button-prev"></div>
      <div class="swiper-button-next" v-if="options.nextButton" slot="button-next"></div>
    </div>
  </div>
</template>

<script>
import config from '~/config'
export default {
    data() {
        return {
          currentIndex: 0,
          baseUrl: config.baseUrl
        }
    },
    props: {
      options: {
            type: Object,
            default: () => {
                return {
                    pagination: {
                        el: '.swiper-pagination',
                        clickable: true,
                    },
                    paginationClickable: true,
                    autoplay: true,
                    speed: 1000,
                    loop: true,
                    observer: true,
                    observeParents: true,
                    autoplayDisableOnInteraction: false,
                    nextButton: '.swiper-button-next',
                    prevButton: '.swiper-button-prev'
                }
            }
        }
      ,dataArr: {
        type: [Array, Object],
        defualt: () => []
      }
    }
}
</script>

<style lang="scss" scoped>
  .swiperWarpper_img {
    width:100%;
    height: 595px;
  }
</style>